package graph;
import tool.*;

public class Vertex {
	
	public String label;
	public int x = 0; //default
	public int y = 0;

	public Vertex(){
		this("*",0,0);
	}
	
	public Vertex(String pLabel, int pX, int pY){
		this.label = pLabel;
		this.x = pX;
		this.y = pY;
	}
	
	public String toString(){
		return label;
	}
	
	public int getX(){
		return x;
	}
	
	public int getY(){
		return y;
	}

	//So vertices with the same label are treated as identical objects
	public int hashCode(){
		return Integer.parseInt(label);
	}
	
	public boolean equals(Object o){
		if(o instanceof Vertex){	
			if((this.label).equals(((Vertex)o).label) && (this.x)==((Vertex)o).getX() && (this.y)==((Vertex)o).getY()){
				return true;
			}
			return false;
		}
		else {
			boolean b = o.equals(this);
			return b;
		}
	}
	
	public Vertex copy(){
		Vertex v = new Vertex(this.label,this.x,this.y);
		return v;
	}
	
	public static void main(String args[]){
		Vertex v = new Vertex("1"+"2",1,2);
		System.out.println(v.getX()+" "+v.getY());
	}

}
